package com.monicaca.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.monicaca.model.User;
import com.monicaca.service.UserService;

@Controller
public class HelloWorldController {
	Logger logger =LoggerFactory.getLogger(HelloWorldController.class);
	
	@Autowired
	private UserService userService;
	
	@ResponseBody
	@RequestMapping("hello")
	public String hello(){
		int id = 1;
		User user = userService.getUser(id);
		logger.info(JSON.toJSONString(user));
		return JSON.toJSONString(user);
	}
}
